<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改客户资料')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-customer-edit" th:object="${basisCustomer}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">客户编码：</label>
                    <div class="col-sm-8">
                        <input name="customerCode" th:field="*{customerCode}" class="form-control" type="text" maxlength="16" required readonly>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">客户名称：</label>
                    <div class="col-sm-8">
                        <input name="customerName" th:field="*{customerName}" class="form-control" type="text" maxlength="30" required>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">营业执照(税号)：</label>
                    <div class="col-sm-8">
                        <input name="businessLicense" th:field="*{businessLicense}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">联系人：</label>
                    <div class="col-sm-8">
                        <input name="contactPerson" th:field="*{contactPerson}" class="form-control" type="text" maxlength="6"  required>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">电话：</label>
                    <div class="col-sm-8">
                        <input name="telephone" th:field="*{telephone}" class="form-control" type="text"  maxlength="16" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">手机：</label>
                    <div class="col-sm-8">
                        <input name="mobilePhone" th:field="*{mobilePhone}" class="form-control" type="text" maxlength="11">
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">邮箱：</label>
                    <div class="col-sm-8">
                        <input name="email" th:field="*{email}" class="form-control" type="text"  maxlength="50">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">地址：</label>
                    <div class="col-sm-8">
                        <input name="address" th:field="*{address}" class="form-control" type="text" maxlength="100" required>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">级别：</label>
                    <div class="col-sm-8">
                        <select name="customerLevel" class="form-control" th:with="type=${@dict.getType('wms_level')}" required>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{customerLevel}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">联系人1：</label>
                    <div class="col-sm-8">
                        <input name="contactPersonOne" th:field="*{contactPersonOne}" class="form-control" type="text" maxlength="6">
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">电话1：</label>
                    <div class="col-sm-8">
                        <input name="telephoneOne" th:field="*{telephoneOne}" class="form-control" type="text" maxlength="16">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">发票抬头：</label>
                    <div class="col-sm-8">
                        <input name="invoiceLookedUp" th:field="*{invoiceLookedUp}" class="form-control" type="text" maxlength="64" required>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">发票税率：</label>
                    <div class="col-sm-8">
                        <input name="invoiceTax" th:field="*{invoiceTax}" class="form-control" type="text" maxlength="4" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label is-required">发票种类：</label>
                    <div class="col-sm-8">
                        <select name="invoiceType" class="form-control m-b" th:with="type=${@dict.getType('sys_invoice')}">
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{invoiceType}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control" maxlength="200">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
        </div>

    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "basis/customer";
    $("#form-customer-edit").validate({
        onkeyup: false,
        rules:{
            email:{
                email:true,
            },
            mobilePhone:{
                isPhone:true,
            },
            telephoneOne:{
                isPhone:true,
            },
            invoiceTax:{
                min:0,
                max:1,
                number:true,
            },
        },
        messages: {
            "email": {
                remote: "Email格式不对"
            },
            "mobilePhone":{
                remote: "手机号码格式不对"
            },
            "telephoneOne":{
                remote: "手机号码格式不对"
            },
            "invoiceTax":{
                remote: "必须输入合法的数字(包含小数)"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-customer-edit').serialize());
        }
    }
</script>
</body>
</html>